package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpContractsQuoterNewQuoterOpenItemPageUtil extends SeleniumPageUtil {
	public final static By NQOI_SELECT_ADDRESS = By.id("ctl04_cboAddressID");
	public final static By NQOI_SELECT_SLA = By.id("ctl04_cboSLATermID");
	public final static By NQOI_INPUT_ITEM_ID = By.id("ctl04_txtItemID");
	public final static By NQOI_CHECKBOX_QUOTERABLE = By.id("ctl04_chkQuotable");
	public final static By NQOI_BOTTON_SEARCH = By.id("ctl04_btnSearch");
	public final static By NQOI_BOTTON_CLEAR = By.id("ctl04_btnClear");
	public final static By NQOI_BOTTON_CLOSE = By.id("ctl04_btnClose");
	public final static By NQOI_DIV_ITEM_ID_LIST = By.id("ctl04_aceItemID_completionListElem");
	public final static By NQOI_LI_ITEM_ID_STAR = By.xpath("//*[@id='ctl04_aceItemID_completionListElem']/li[2]");
	
	/** elements display after search*/
	public final static By NQOI_CHECKBOX_153507_B21 = By.xpath("//*[@id='ctl04_tblResults']/tbody/tr/td[text()='153507-B21']/preceding-sibling::td[1]/input");
	public final static By NQOI_LINK_SAVE = By.xpath("//*[@id='ctl04_lblResults']/table/tbody/tr/td/a");
	
	// the page next of currently page
	public final static By NQOI_SPAN_LINK_NEXT_PAGE = By.xpath("//*[@id='ctl04_lblResults']/div[1]/b/following-sibling::span[1]");
	
	public static void waitForOpenItemPageToLoad() {
		SeleniumUtil.waitOnElements(new By[]{
				NQOI_SELECT_ADDRESS,NQOI_SELECT_SLA,NQOI_INPUT_ITEM_ID,NQOI_CHECKBOX_QUOTERABLE, NQOI_BOTTON_SEARCH,
				NQOI_BOTTON_CLEAR, NQOI_BOTTON_CLOSE
		});
		SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(NQOI_SELECT_ADDRESS));
		SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(NQOI_SELECT_SLA));
		SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(NQOI_INPUT_ITEM_ID));
		SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(NQOI_CHECKBOX_QUOTERABLE));
		SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(NQOI_BOTTON_SEARCH));
		SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(NQOI_BOTTON_CLEAR));
		SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(NQOI_BOTTON_CLOSE));
	}
}
